#ifndef PHYSX_CONSOLE_OUTPUT_STREAM_H
#define PHYSX_CONSOLE_OUTPUT_STREAM_H

#include "WindowsCompatibility/Physx.h"
#include "Game.h"

class PhysxConsoleOutputStream : public NxUserOutputStream {
	static const std::string messagePrefix;

	void reportError(NxErrorCode code, const char *message, const char* file, int line) {
		if(code==NXE_DB_INFO || code==NXE_DB_PRINT || code==NXE_NO_ERROR) {
			Game::log.LogInfo(messagePrefix + message);
		} else if(code==NXE_DB_WARNING) {
			Game::log.LogWarn(messagePrefix + message);
		} else {
			Game::log.LogError(messagePrefix + message);
		}
	}

	NxAssertResponse reportAssertViolation(const char *message, const char *file,int line) {
		assert(0);
		return NX_AR_CONTINUE;
	}

	void print(const char *message) {
		Game::log.LogInfo(messagePrefix + message);
	}
} physxConsoleOutputStream;

const std::string PhysxConsoleOutputStream::messagePrefix("PhysX SDK: ");

#endif //PHYSX_CONSOLE_OUTPUT_STREAM_H
